//package com.plian.system.service.tb.impl;
//
//import com.alibaba.fastjson.JSON;
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
//import com.baomidou.mybatisplus.core.toolkit.Wrappers;
//import com.plian.Tools.*;
//import com.plian.Tools.pagedata.PageData;
//import com.plian.system.common.status.CheckStatus;
//import com.plian.system.config.YthTaskObserver;
//import com.plian.system.constant.sys.FormStatusConstant;
//import com.plian.system.constant.sys.FormTypeConstant;
//import com.plian.system.constant.tb.TripleStatusConstant;
//import com.plian.system.constant.yth.YthConstant;
//import com.plian.system.entity.sys.User;
//import com.plian.system.entity.tb.*;
//import com.plian.system.mapper.tb.TripleMeetingMapper;
//import com.plian.system.mybatis.base.BaseFlowService;
//import com.plian.system.mybatis.base.BaseServiceImpl;
//import com.plian.system.mybatis.support.Condition;
//import com.plian.system.service.sys.code.IFormCodeService;
//import com.plian.system.service.sys.message.IApprovalMessageService;
//import com.plian.system.service.sys.orgzation.IOrgService;
//import com.plian.system.service.sys.user.ISysUserService;
//import com.plian.system.service.tb.*;
//import com.plian.system.service.wf.FormWorkflowService;
//import com.plian.system.service.yth.IConferenceMeetingService;
//import com.plian.system.vo.tb.TripleEventVO;
//import com.plian.system.vo.tb.TripleMeetingVO;
//import com.plian.system.vo.tb.TripleSystemVO;
//import com.plian.system.vo.yth.YthResult;
//import com.plian.system.wrapper.tb.TripleMeetingWrapper;
//import lombok.AllArgsConstructor;
//import org.apache.commons.lang.exception.ExceptionUtils;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//
//import java.util.*;
//import java.util.stream.Collectors;
//
//import static com.plian.system.constant.sys.FormStatusConstant.UNREVIEWED;
//
///**
// * @Author: Take-off
// * @Description: TODO
// * @Date: 2022/12/23 10:57 AM
// * @Version: 1.0
// **/
//@Service
//@AllArgsConstructor
//public class TripleMeetingServiceImpl extends BaseServiceImpl<TripleMeetingMapper, TripleMeeting> implements ITripleMeetingService, BaseFlowService {
//
//    private FormWorkflowService formWorkflowService;
//
//    private IFormCodeService formCodeService;
//
//    private TripleMeetingWrapper tripleMeetingWrapper;
//
//    private final ITopicRelevanceService topicRelevanceService;
//
//    private final ITripleMeetingTopicService meetingTopicService;
//
//    private final IMeetingParticipantService meetingParticipantService;
//
//    private final IMeetingAttendeeService meetingAttendeeService;
//
//    private final ITripleSystemService tripleSystemService;
//
//    private final ITripleEventService tripleEventService;
//
//    private final IMeetingMinutesService meetingMinutesService;
//
//    private final IConferenceMeetingService conferenceMeetingService;
//
//    private final IOrgService orgService;
//
//    private final ISysUserService userService;
//
//    private IApprovalMessageService approvalMessageService;
//    @Override
//    public boolean saveOrUpdate(TripleMeeting tripleMeeting) {
//        if (!Optional.ofNullable(tripleMeeting.getMeetStatus()).isPresent()) {
//            tripleMeeting.setMeetStatus(TripleStatusConstant.UNREVIEWED);
//        }
//        if (!Optional.ofNullable(tripleMeeting.getId()).isPresent()) {
//            tripleMeeting.setCode(formCodeService.getCode(FormTypeConstant.PF_TRIPLE_MEETING));
//            tripleMeeting.setFormType(String.valueOf(FormTypeConstant.PF_TRIPLE_MEETING));
//        }
//        if (!Optional.ofNullable(tripleMeeting.getMeetingNumber()).isPresent()) {
//            tripleMeeting.setMeetingNumber(formCodeService.getCodeName(FormTypeConstant.PF_TRIPLE_MEETING));
//        }
//        boolean result = super.saveOrUpdate(tripleMeeting);
//        return result;
//    }
//
//    @Override
//    @Transactional(rollbackFor=RuntimeException.class)
//    public boolean deleteLogic(List<Long> ids) {
//        for (Long id : ids) {
//            TripleMeeting tripleMeeting = getById(id);
//            if (tripleMeeting == null) {
//                return false;
//            } else if (tripleMeeting.getStatus() != null &&
//                    (tripleMeeting.getStatus() != FormStatusConstant.STASH && tripleMeeting.getStatus() != FormStatusConstant.UNREVIEWED)) {
//                return false;
//            }
//            formWorkflowService.deleteProcessInstance(String.valueOf(id));
//
//            meetingTopicService.deleteByParentId(ids);
//            meetingParticipantService.deleteByParentId(ids);
//            meetingAttendeeService.deleteByParentId(ids);
//
//        }
//        return super.deleteLogic(ids);
//    }
//
//    @Override
//    public HashMap<String,Object> commit(String id) {
//        handleStatus(Long.valueOf(id), FormStatusConstant.FLOW);
//
//        //将需要提交的流程变量返回，用于工作流侧
//        return new HashMap<String,Object>();
//    }
//
//    @Override
//    public Boolean finish(String id) {
//        TripleMeeting tripleMeeting = getById(id);
//        tripleMeeting.setMeetStatus(TripleStatusConstant.CANCEL);
//        updateById(tripleMeeting);
//        return handleStatus(Long.valueOf(id), FormStatusConstant.FINISH);
//    }
//
//    @Override
//    public Boolean reject(String id, int formState,String comment) {
//        //关联信息
//        List<TopicRelevance> topicRelevances = topicRelevanceService.list(new LambdaQueryWrapper<TopicRelevance>().eq(TopicRelevance::getBaseMeetingId, id));
//        //修改事项状态
//        List<Long> eventIds = topicRelevances.stream().filter(m -> m.getRelevanceType() == 1).map(TopicRelevance::getRelevanceId).collect(Collectors.toList());
//        if (CollectionUtil.isNotEmpty(eventIds)){
//            tripleEventService.changeStatus(eventIds,TripleStatusConstant.LATER);
//        }
//        //修改制度状态
//        List<Long> systemIds = topicRelevances.stream().filter(m -> m.getRelevanceType() == 2).map(TopicRelevance::getRelevanceId).collect(Collectors.toList());
//        if (CollectionUtil.isNotEmpty(systemIds)){
//            tripleSystemService.changeStatus(systemIds,TripleStatusConstant.LATER);
//        }
//        return handleStatus(Long.valueOf(id), formState);
//    }
//
//    @Override
//    public List<PageData> findByIds(List<String> formIds) {
//        LambdaQueryWrapper<TripleMeeting> queryWrapper = new LambdaQueryWrapper<>();
//        queryWrapper.in(TripleMeeting::getId, Func.toLongList(StringUtils.join(formIds, StringPool.COMMA)));
//        List<TripleMeeting> tripleMeetings = list(queryWrapper);
//        List<TripleMeetingVO> tripleMeetingVOS = tripleMeetingWrapper.entityToVO(tripleMeetings);
//        List<PageData> pageDataList = new ArrayList<>();
//        try{
//            if (CollectionUtil.isNotEmpty(tripleMeetingVOS)){
//                for (TripleMeetingVO vo : tripleMeetingVOS){
//                    PageData pd = new PageData();
//                    pd.put("id", vo.getId());
//                    pd.put("UNITNAME", vo.getFillingUnitName());
//                    pd.put("APPLICANTNAME", vo.getCreateUserName());
//                    pd.put("applicantId", vo.getCreateUser());
//                    pd.put("applyOrganizationId", vo.getFillingUnitId());
//                    pd.put("formType", FormTypeConstant.PF_TRIPLE_MEETING);
//                    pd.put("orgName", vo.getFillingUnitName());
//                    pageDataList.add(pd);
//                }
//            }
//
//            return pageDataList;
//        } catch (Exception e) {
//            log.error(ExceptionUtils.getFullStackTrace(e));
//        }
//        return pageDataList;
//    }
//
//    @Override
//    public List<Integer> getFormType() {
//        return Arrays.asList(FormTypeConstant.PF_TRIPLE_MEETING);
//    }
//
//    @Override
//    public void goBackToStash(String formId) {
//        handleStatus(Long.valueOf(formId), UNREVIEWED);
//    }
//
//    /**
//     * 统一处理状态机事件方法
//     *
//     * @param id          主键
//     * @param updateStatus  更新状态
//     * @return boolean
//     */
//    private Boolean handleStatus(Long id, int updateStatus) {
//        try {
//            TripleMeeting tripleMeeting = getById(id);
//            /**
//             * 设置审批人和审批时间
//             */
//            if (updateStatus == FormStatusConstant.FINISH){
//                tripleMeeting.setApprovedUser(TokenUtil.getTokenUserId());
//                Date now = DateUtil.now();
//                tripleMeeting.setApprovedTime(now);
//            }
//            tripleMeeting.setStatus(updateStatus);
//            updateById(tripleMeeting);
//            return true;
//        } catch (Exception e) {
//            log.error(ExceptionUtils.getFullStackTrace(e));
//            return false;
//        }
//    }
//
//    @Override
//    @Transactional(rollbackFor=RuntimeException.class)
//    public boolean submit(TripleMeeting tripleMeeting) {
//        if (Optional.ofNullable(tripleMeeting.getId()).isPresent()){
//            //删除老的关联关系
//            List<Long> meetIds = new ArrayList<>();
//            meetIds.add(tripleMeeting.getId());
//            topicRelevanceService.deleteByMeetingId(meetIds);
//        }
//
//        boolean result = saveOrUpdate(tripleMeeting);
//        if (result){
//            //议题
//            List<TripleMeetingTopic> meetingTopics = tripleMeeting.getMeetingTopics();
//            if (CollectionUtil.isNotEmpty(meetingTopics)){
//                for (TripleMeetingTopic meetingTopic:meetingTopics){
//                    meetingTopic.setBaseMeetingId(tripleMeeting.getId());
//                    if (Optional.ofNullable(meetingTopic.getIsDeleted()).isPresent() && meetingTopic.getIsDeleted() == 1){
//                        meetingTopicService.deleteLogic(Arrays.asList(meetingTopic.getId()));
//                    }else {
//                        meetingTopicService.saveOrUpdate(meetingTopic);
//                        if ( !(StringUtils.isNotBlank(tripleMeeting.getDataSource()) && StringUtils.isNotBlank(tripleMeeting.getDataSourceId())) ){
//                            //关联信息
//                            List<TopicRelevance> topicRelevances = meetingTopic.getTopicRelevances();
//                            if (CollectionUtil.isNotEmpty(topicRelevances)){
//                                //修改事项状态
//                                List<Long> eventIds = topicRelevances.stream().filter(m -> m.getRelevanceType() == 1).map(TopicRelevance::getRelevanceId).collect(Collectors.toList());
//                                if (CollectionUtil.isNotEmpty(eventIds)){
//                                    tripleEventService.changeStatus(eventIds,TripleStatusConstant.PENDING);
//                                }
//                                //修改制度状态
//                                List<Long> systemIds = topicRelevances.stream().filter(m -> m.getRelevanceType() == 2).map(TopicRelevance::getRelevanceId).collect(Collectors.toList());
//                                if (CollectionUtil.isNotEmpty(systemIds)){
//                                    tripleSystemService.changeStatus(systemIds,TripleStatusConstant.PENDING);
//                                }
//                            }
//                        }
//                    }
//                }
//            }
//            //参会人
//            List<MeetingParticipant> meetingParticipants = tripleMeeting.getMeetingParticipants();
//            if (CollectionUtil.isNotEmpty(meetingParticipants)){
//                meetingParticipants.forEach(participant ->{
//                    participant.setBaseMeetingId(tripleMeeting.getId());
//                    if (Optional.ofNullable(participant.getIsDeleted()).isPresent() && participant.getIsDeleted() == 1){
//                        meetingParticipantService.deleteLogic(Arrays.asList(participant.getId()));
//                    }else {
//                        meetingParticipantService.saveOrUpdate(participant);
//                    }
//                });
//            }
//            //列席人
//            List<MeetingAttendee> meetingAttendees = tripleMeeting.getMeetingAttendees();
//            if (CollectionUtil.isNotEmpty(meetingAttendees)){
//                meetingAttendees.forEach(attendee ->{
//                    attendee.setBaseMeetingId(tripleMeeting.getId());
//                    if (Optional.ofNullable(attendee.getIsDeleted()).isPresent() && attendee.getIsDeleted() == 1){
//                        meetingAttendeeService.deleteLogic(Arrays.asList(attendee.getId()));
//                    }else {
//                        meetingAttendeeService.saveOrUpdate(attendee);
//                    }
//                });
//            }
//        }
//        return result;
//    }
//
//    @Override
//    public TripleMeetingVO getDetailObj(TripleMeeting tripleMeeting) {
//        TripleMeeting detail = getOne(Condition.getQueryWrapper(tripleMeeting));
//        TripleMeetingVO tripleMeetingVO = tripleMeetingWrapper.entityToVO(detail);
//        //议题信息
//        List<TripleMeetingTopic> topics = meetingTopicService.list(new LambdaQueryWrapper<TripleMeetingTopic>().eq(TripleMeetingTopic::getBaseMeetingId, detail.getId()));
//
//        //关联信息
//        List<TopicRelevance> relevances = topicRelevanceService.list(new LambdaQueryWrapper<TopicRelevance>().eq(TopicRelevance::getBaseMeetingId, detail.getId()));
//        if (CollectionUtil.isNotEmpty(topics)){
//            topics.forEach(topic ->{
//                if (CollectionUtil.isNotEmpty(relevances)){
//                    List<TopicRelevance> topicRelevances = relevances.stream().filter(m -> m.getTopicId().equals(topic.getId())).collect(Collectors.toList());
//                    topic.setTopicRelevances(topicRelevances);
//                }
//            });
//            tripleMeetingVO.setMeetingTopics(topics);
//        }
//        //参会人
//        List<MeetingParticipant> participants = meetingParticipantService.list(new LambdaQueryWrapper<MeetingParticipant>().eq(MeetingParticipant::getBaseMeetingId, detail.getId()));
//        tripleMeetingVO.setMeetingParticipants(participants);
//
//        //列席人
//        List<MeetingAttendee> attendees = meetingAttendeeService.list(new LambdaQueryWrapper<MeetingAttendee>().eq(MeetingAttendee::getBaseMeetingId, detail.getId()));
//        tripleMeetingVO.setMeetingAttendees(attendees);
//
//        //会议纪要
//        MeetingMinutes meetingMinutes = meetingMinutesService.getOne(new LambdaQueryWrapper<MeetingMinutes>().eq(MeetingMinutes::getBaseMeetingId, detail.getId()));
//        if (Optional.ofNullable(meetingMinutes).isPresent()){
//            tripleMeetingVO.setMeetingMinutesId(meetingMinutes.getId());
//        }
//        return tripleMeetingVO;
//    }
//
//    @Override
//    public void setEventMeetDetail(TripleEventVO tripleEventVO){
//        //关联信息
//        TopicRelevance relevances = topicRelevanceService.getOne(new LambdaQueryWrapper<TopicRelevance>().eq(TopicRelevance::getRelevanceType,1).eq(TopicRelevance::getRelevanceId, tripleEventVO.getId()));
//        if (Optional.ofNullable(relevances).isPresent()){
//            tripleEventVO.setResult(relevances.getResult());
//            tripleEventVO.setRemarks(relevances.getRemarks());
//            //议题名称
//            TripleMeetingTopic topic = meetingTopicService.getById(relevances.getTopicId());
//            if (Optional.ofNullable(topic).isPresent()){
//                tripleEventVO.setTopicName(topic.getTopicName());
//            }
//            //会议信息
//            TripleMeeting tripleMeeting = getById(relevances.getBaseMeetingId());
//            if (Optional.ofNullable(tripleMeeting).isPresent()){
//                tripleEventVO.setMeetingName(tripleMeeting.getMeetingName());
//                tripleEventVO.setMeetingNumber(tripleMeeting.getMeetingNumber());
//            }
//
//            //会议纪要Id
//            MeetingMinutes meetingMinutes = meetingMinutesService.getOne(new LambdaQueryWrapper<MeetingMinutes>().eq(MeetingMinutes::getBaseMeetingId, tripleMeeting.getId()));
//            if (Optional.ofNullable(meetingMinutes).isPresent()){
//                tripleEventVO.setMeetingMinutesId(meetingMinutes.getId());
//            }
//
//        }
//    }
//
//    @Override
//    public void setSystemMeetDetail(TripleSystemVO tripleSystemVO){
//        //关联信息
//        TopicRelevance relevances = topicRelevanceService.getOne(new LambdaQueryWrapper<TopicRelevance>().eq(TopicRelevance::getRelevanceType,2).eq(TopicRelevance::getRelevanceId, tripleSystemVO.getId()));
//        if (Optional.ofNullable(relevances).isPresent()){
//            tripleSystemVO.setResult(relevances.getResult());
//            tripleSystemVO.setRemarks(relevances.getRemarks());
//            //议题名称
//            TripleMeetingTopic topic = meetingTopicService.getById(relevances.getTopicId());
//            tripleSystemVO.setTopicName(topic.getTopicName());
//            //会议信息
//            TripleMeeting tripleMeeting = getById(relevances.getBaseMeetingId());
//            tripleSystemVO.setMeetingName(tripleMeeting.getMeetingName());
//            tripleSystemVO.setMeetingNumber(tripleMeeting.getMeetingNumber());
//            //会议纪要Id
//            MeetingMinutes meetingMinutes = meetingMinutesService.getOne(new LambdaQueryWrapper<MeetingMinutes>().eq(MeetingMinutes::getBaseMeetingId, tripleMeeting.getId()));
//            tripleSystemVO.setMeetingMinutesId(meetingMinutes.getId());
//        }
//    }
//
//    @Override
//    public String saveSystemMeetList(String data) {
//        YthResult ythResult = new YthResult();
//        //成功的id集合
//        List<String> successIds = new ArrayList<>();
//        //失败的id集合
//        List<String> failIds = new ArrayList<>();
//        //失败的原因
//        List<String> failReasons = new ArrayList<>();
//        //将json字符串转换成list
//        List<TripleMeeting> dataList = JSON.parseArray(data, TripleMeeting.class);
//        if (CollectionUtil.isNotEmpty(dataList)){
//            //根据datasourceIds 查询出所有的数据
//            List<TripleMeeting> list = list(new LambdaQueryWrapper<TripleMeeting>().in(TripleMeeting::getDataSourceId, dataList.stream().map(TripleMeeting::getDataSourceId).toArray()));
//            if (CollectionUtil.isNotEmpty(list)){
//                //删除子集
//                List<Long> ids = list.stream().map(TripleMeeting::getId).collect(Collectors.toList());
//                if (CollectionUtil.isNotEmpty(ids)){
//                    meetingTopicService.deleteByParentId(ids);
//                    meetingParticipantService.deleteByParentId(ids);
//                    meetingAttendeeService.deleteByParentId(ids);
//                }
//            }
//            //如果数据库中有数据，就更新，没有就新增
//            for (TripleMeeting entity:dataList){
//                //id重复略过
//                if (CollectionUtil.isNotEmpty(list)){
//                    List<String> olIds = list.stream().map(TripleMeeting::getDataSourceId).collect(Collectors.toList());
//                    String dataSourceId = entity.getDataSourceId();
//                    //判断数据库中是否有数据
//                    if (olIds.contains(dataSourceId)){
//                        for (TripleMeeting oldEntity:list){
//                            if (dataSourceId.equals(oldEntity.getDataSourceId())){
//                                //判断status是否为0，如果是0，就更新，不是0，就不更新
//                                if (CheckStatus.checkCode(oldEntity.getStatus())){
//                                    successIds.add(dataSourceId);
//                                    entity.setId(oldEntity.getId());
//                                    entity.setDataSource(YthConstant.DATA_NINGBO);
//                                    submit(entity);
//                                    list.remove(oldEntity);
//                                    break;
//                                }else {
//                                    failIds.add(dataSourceId);
//                                    failReasons.add("dataSourceId:"+dataSourceId+"数据已提交且已经在流程中，无法更新");
//                                    break;
//                                }
//                            }
//                        }
//                    }else {
//                        //如果数据库中没有数据，就新增
//                        entity.setDataSource(YthConstant.DATA_NINGBO);
//                        submit(entity);
//                        successIds.add(entity.getDataSourceId());
//                    }
//                }else {
//                    //如果数据库中没有数据，就新增
//                    entity.setDataSource(YthConstant.DATA_NINGBO);
//                    submit(entity);
//                    successIds.add(entity.getDataSourceId());
//                }
//            }
//        } else {
//            failReasons.add("数据为空");
//        }
//        ythResult.setSuccessIds(successIds);
//        ythResult.setFailIds(failIds);
//        ythResult.setFailReason(StringUtils.join(failReasons, ";"));
//        //ythResult转换成json字符串
//        return JSON.toJSONString(ythResult);
//    }
//
//    @Override
//    @YthTaskObserver
//    public boolean saveMeetByDataSource(String date){
//        boolean flag = true;
//        Date start = DateUtil.parse(date, DateUtil.PATTERN_DATE);
//        //获取数据
////        List<TripleMeeting> tripleMeetings = conferenceMeetingService.getAllProject(start, DateUtil.plusDays(start, 1));
//        List<TripleMeeting> tripleMeetings = conferenceMeetingService.getAllProject(null, null);
//        remove(Wrappers.<TripleMeeting>lambdaQuery().eq(TripleMeeting::getDataSource,3));
//
//        Map<String, String> orgSourceIds = orgService.getSourceId();
//        Map<String, User> userSource = userService.getSourceEntity();
//        if (CollectionUtil.isNotEmpty(tripleMeetings)){
//            //获取修改数据
//            List<TripleMeeting> oldMeets = list(Wrappers.<TripleMeeting>lambdaQuery().eq(TripleMeeting::getDataSource, YthConstant.DATA_NINGBO)
//                    .in(TripleMeeting::getDataSourceId, tripleMeetings.stream().map(TripleMeeting::getDataSourceId).collect(Collectors.toList())));
//            if (CollectionUtil.isNotEmpty(oldMeets)){
//                //删除子集
//                List<Long> ids = oldMeets.stream().map(TripleMeeting::getId).collect(Collectors.toList());
//                if (CollectionUtil.isNotEmpty(ids)){
//                    meetingTopicService.deleteByParentId(ids);
//                    meetingParticipantService.deleteByParentId(ids);
//                    meetingAttendeeService.deleteByParentId(ids);
//                    meetingMinutesService.remove(Wrappers.<MeetingMinutes>lambdaQuery().in(MeetingMinutes::getBaseMeetingId,ids));
//                }
//            }
//            //获取事项
//            List<TripleEvent> tripleEvents = tripleEventService.list(Wrappers.<TripleEvent>lambdaQuery().eq(TripleEvent::getDataSource, YthConstant.DATA_NINGBO));
//            //获取制度
//            List<TripleSystem> tripleSystems = tripleSystemService.list(Wrappers.<TripleSystem>lambdaQuery().eq(TripleSystem::getDataSource, YthConstant.DATA_NINGBO));
//            for (TripleMeeting meeting:tripleMeetings){
//                String orgId = orgSourceIds.get(meeting.getFillingUnitId());
//                if (StringUtils.isNotBlank(orgId)){
//                    meeting.setFillingUnitId(orgId);
//                    meeting.setCreateCompanyId(orgId);
//                }
//                User user = userSource.get(meeting.getReportUser());
//                Optional.ofNullable(user).ifPresent( m -> {
//                    meeting.setReportUser(user.getId());
//                });
//                //议题
//                List<TripleMeetingTopic> meetingTopics = meeting.getMeetingTopics();
//                if (CollectionUtil.isNotEmpty(meetingTopics)){
//                    for (TripleMeetingTopic topic:meetingTopics){
//                        StringBuilder relevanceName = new StringBuilder();
//                        StringBuilder relevanceCode = new StringBuilder();
//                        //关联信息
//                        List<TopicRelevance> topicRelevances = topic.getTopicRelevances();
//                        if (CollectionUtil.isNotEmpty(topicRelevances)){
//                            for (TopicRelevance relevance:topicRelevances){
//                                if (relevance.getRelevanceType() == 1){
//                                    //事项
//                                    if (CollectionUtil.isNotEmpty(tripleEvents)){
//                                        tripleEvents.stream().filter(m -> relevance.getRelevanceId().toString().equals(m.getDataSourceId())).findFirst().ifPresent(tripleEvent ->{
//                                            String eventName = tripleEvent.getEventName();
//                                            String eventNumber = tripleEvent.getEventNumber();
//                                            relevanceName.append(eventName).append(",");
//                                            relevanceCode.append(eventNumber).append(",");
//                                            relevance.setRelevanceId(tripleEvent.getId());
//                                            relevance.setRelevanceName(eventName);
//                                            relevance.setRelevanceCode(eventNumber);
//                                            //修改事项状态
//                                            tripleEvent.setEventStatus(relevance.getResult());
//                                            tripleEventService.saveOrUpdate(tripleEvent);
//
//                                        });
//                                    }
//                                }else if (relevance.getRelevanceType() == 2){
//                                    //制度
//                                    if (CollectionUtil.isNotEmpty(tripleSystems)){
//                                        tripleSystems.stream().filter(m -> relevance.getRelevanceId().toString().equals(m.getDataSourceId())).findFirst().ifPresent(tripleSystem ->{
//                                            String name = tripleSystem.getSystemName();
//                                            String number = tripleSystem.getSystemNumber();
//                                            relevanceName.append(name).append(",");
//                                            relevanceCode.append(number).append(",");
//                                            relevance.setRelevanceId(tripleSystem.getId());
//                                            relevance.setRelevanceName(name);
//                                            relevance.setRelevanceCode(number);
//                                            //修改事项状态
//                                            tripleSystem.setSystemStatus(relevance.getResult());
//                                            tripleSystemService.saveOrUpdate(tripleSystem);
//                                        });
//                                    }
//                                }
//                            }
//                            String name = relevanceName.toString();
//                            if (StringUtil.isNotBlank(name)){
//                                topic.setRelevanceName(name.substring(0,name.length()-1));
//                            }
//                            String code = relevanceCode.toString();
//                            if (StringUtil.isNotBlank(code)){
//                                topic.setRelevanceCode(code.substring(0,code.length()-1));
//                            }
//                        }
//                    }
//                }
//                //参会人
//                List<MeetingParticipant> meetingParticipants = meeting.getMeetingParticipants();
//                if (CollectionUtil.isNotEmpty(meetingParticipants)){
//                    for (MeetingParticipant participant:meetingParticipants){
//                        Optional.ofNullable(userSource.get(participant.getName())).ifPresent(m ->{
//                            participant.setName(m.getName());
//                        });
//                    }
//                }
//                //列席人
//                List<MeetingAttendee> meetingAttendees = meeting.getMeetingAttendees();
//                if (CollectionUtil.isNotEmpty(meetingAttendees)){
//                    for (MeetingAttendee attendee:meetingAttendees){
//                        Optional.ofNullable(userSource.get(attendee.getName())).ifPresent( m ->{
//                            attendee.setName(m.getName());
//                        });
//                    }
//                }
//                if (CollectionUtil.isNotEmpty(oldMeets)){
//                    oldMeets.stream().filter(m -> meeting.getDataSourceId().equals(m.getDataSourceId())).findFirst().ifPresent(m -> {
//                                meeting.setId(m.getId());
//                    });
//                }
//                flag = submit(meeting);
//                //会议既要
//                MeetingMinutes minutes = new MeetingMinutes();
//                minutes.setBaseMeetingId(meeting.getId());
//                minutes.setSummaryAttachId(meeting.getSummaryAttachId());
//                meetingMinutesService.saveOrUpdate(minutes);
//            }
//        }
//        return flag;
//    }
//
//}
